import { ChatCellData } from "../chatViewData/ChatCellData";
import { ObjectPool } from "../../../../../com/gengine/utils/pools/ObjectPool";
import { ListMenu } from "../../common/menu/ListMenu";
import { PlayerMenuCellRenderer } from "../../common/menu/PlayerMenuCellRenderer";
import { ListEvent } from "../../../../../fl/events/ListEvent";
import { CellDataType } from "../chatViewData/CellDataType";
import { ChatBitmap } from "../ChatBitmap";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { FlyFootBmp } from "../../mapUI/flyFoot/FlyFootBmp";
import { SPublicMiniPlayer } from "../../../../../Message/Public/SPublicMiniPlayer";
import { SEntityId } from "../../../../../Message/Public/SEntityId";
import { PlayerMiniInfo } from "../../../model/PlayerMiniInfo";
import { GTextFormat } from "../../../../common/GTextFormat";
import { BrowerUtil } from "../../../../../com/gengine/utils/BrowerUtil";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { Cache } from "../../../cache/Cache";
import { AIManager } from "../../../scene/ai/AIManager";
import { TaskTargetInfo } from "../../../model/TaskTargetInfo";
import { EntityType } from "../../../rules/EntityType";
import { AIType } from "../../../scene/ai/AIType";
import { LayerManager } from "../../../manager/LayerManager";
import { PlayerOpMenuConst } from "../../common/menu/PlayerOpMenuConst";
import { Global } from "../../../../../com/gengine/global/Global";
import { ELottertType } from "../../../../../Message/Public/ELottertType";
import { ENpcEffect } from "../../../../../Message/Public/ENpcEffect";
import { ItemData } from "../../../resource/info/ItemData";
import { Tooltip } from "../../common/tooltip/Tooltip";
import { ObjCreate } from "../../common/ObjCreate";
import { ECategory } from "../../../../../Message/Public/ECategory";
import { SPetInfo } from "../../../../../Message/Game/SPetInfo";
import { CopyConfig } from "../../../resource/CopyConfig";
import { CopyUtil } from "../../copy/CopyUtil";
import { GameMapUtil } from "../../../scene/map/GameMapUtil";
import { MsgManager } from "../../../manager/MsgManager";
import { Language } from "../../../../../extend/language/Language";
import { Alert } from "../../../../../com/mui/controls/Alert";
import { EItemUpdateOper } from "../../../../../Message/Game/EItemUpdateOper";
import { ECopyType } from "../../../../../Message/Public/ECopyType";
import { PetEventName } from "../../pet/PetEventName";
import { SIslandPos } from "../../../../../Message/Game/SIslandPos";
import { GButton } from "../../../../../com/mui/controls/GButton";
type int = number;
//class ChatCell
    
    export  class ChatCell
    {
        

        public set cellData(arg1: ChatCellData)
        {
            this._cellData = arg1;
            return;
        }

        public get cellContentElement(): Object /* flash.text.engine.ContentElement */
        {
            return this._cellContentElement;
        }

        public dispose(): void
        {
            this._cellContentElement = null;
            this._elementFormat = null;
            this._dipatcher = null;
            this._cellData.dispose();
            this._cellData = null;
            ObjectPool.disposeObject(this);
            return;
        }

        
        {
            ChatCell._spTooltipContainer = new Object /* flash.display.Sprite */();
        }

        public init(arg1: ChatCellData): void
        {
            this._cellData = arg1;
            this._elementFormat = arg1.elementFormat ? arg1.elementFormat : new Object /* flash.text.engine.ElementFormat */();
            this._dipatcher = new Object /* flash.events.EventDispatcher */();
            if (!ChatCell._playerOpList) 
            {
                ChatCell._playerOpList = new ListMenu();
                ChatCell._playerOpList.width = 86;
                ChatCell._playerOpList.visible = false;
                ChatCell._playerOpList.list.setStyle("cellRenderer", PlayerMenuCellRenderer);
                ChatCell._playerOpList.list.drawNow();
                ChatCell._playerOpList.list.addEventListener(ListEvent.ITEM_CLICK, this.playerOpItemSelect);
            }
            this.create();
            return;
        }

        /* internal  */create(): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=0;
            var loc7=null;
            var loc8=0;
            var loc9=0;
            var loc10=null;
            var loc11=null;
            var loc12=null;
            var loc13=this._cellData.type;
            switch (loc13) 
            {
                case CellDataType.IMAGE:
                {
                    loc1 = new ChatBitmap(GlobalClass.getBitmapData(this._cellData.className));
                    this._cellContentElement = new Object /* flash.text.engine.GraphicElement */(loc1, loc1.width, loc1.height, this._elementFormat);
                    break;
                }
                case CellDataType.RumorFly:
                {
                    loc2 = new FlyFootBmp();
                    this._cellContentElement = new Object /* flash.text.engine.GraphicElement */(loc2, loc2.width + 2, loc2.height, this._elementFormat, this._dipatcher);
                    (this._cellContentElement as Object /* flash.text.engine.GraphicElement */).graphic.filters = [];
                    this.setMouseCanClick();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.flyToMapPositionHandler);
                    break;
                }
                case CellDataType.MovieClip:
                {
                    loc3 = GlobalClass.getInstance(this._cellData.className) as Object /* flash.display.MovieClip */;
                    loc3.mouseEnabled = false;
                    loc3.mouseChildren = false;
                    loc3.addEventListener(flash.events.Event.ADDED_TO_STAGE, this.onMCAddToStage);
                    loc3.addEventListener(flash.events.Event.REMOVED_FROM_STAGE, this.onMCRemoveFromStage);
                    if (this._cellData.className.indexOf("c") == -1) 
                    {
                        this._cellContentElement = new Object /* flash.text.engine.GraphicElement */(loc3, loc3.width, loc3.height, this._elementFormat);
                    }
                    else 
                    {
                        this._cellContentElement = new Object /* flash.text.engine.GraphicElement */(loc3, 60, 40, this._elementFormat);
                    }
                    (this._cellContentElement as Object /* flash.text.engine.GraphicElement */).graphic.filters = [];
                    break;
                }
                case CellDataType.VIP:
                {
                    loc4 = new ChatBitmap(GlobalClass.getBitmapData(this._cellData.className));
                    (loc5 = new Object /* flash.display.Sprite */()).addChild(loc4);
                    this._cellContentElement = new Object /* flash.text.engine.GraphicElement */(loc5, loc5.width, loc5.height, this._elementFormat, this._dipatcher);
                    this.setMouseCanClick();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.openVIPHandler);
                    break;
                }
                case CellDataType.GENERAL:
                {
                    this._cellContentElement = new Object /* flash.text.engine.TextElement */(this._cellData.text, this._elementFormat, null);
                    break;
                }
                case CellDataType.EQUIPMENT:
                {
                    this._cellContentElement = new Object /* flash.text.engine.TextElement */(this._cellData.text, this._elementFormat, this._dipatcher);
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.showToolTipHandler);
                    this.setMouseCanClick();
                    break;
                }
                case CellDataType.RumorItem:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.showToolTipHandler);
                    break;
                }
                case CellDataType.PET:
                {
                    this._cellContentElement = new Object /* flash.text.engine.TextElement */(this._cellData.text, this._elementFormat, this._dipatcher);
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.showPetHandler);
                    this.setMouseCanClick();
                    break;
                }
                case CellDataType.PLAYER:
                {
                    this._cellContentElement = new Object /* flash.text.engine.TextElement */(this._cellData.text, this._elementFormat, this._dipatcher);
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.showPlayerOperate);
                    this.setMouseCanClick();
                    break;
                }
                case CellDataType.RumorPlayer:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.showPlayerOperate);
                    break;
                }
                case CellDataType.Charge:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.onClickCharge);
                    break;
                }
                case CellDataType.RumorTran:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.gotoTran);
                    break;
                }
                case CellDataType.RumorTreasure:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.openTreasure);
                    break;
                }
                case CellDataType.RumorActive:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.openActive);
                    break;
                }
                case CellDataType.EnterGuildManor:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.enterMyGuildManor);
                    break;
                }
                case CellDataType.CAMP:
                {
                    this._cellContentElement = new Object /* flash.text.engine.TextElement */(this._cellData.text, this._elementFormat, null);
                    break;
                }
                case CellDataType.LINK:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.linkToUrlHandler);
                    break;
                }
                case CellDataType.FastApplyToGUILD:
                {
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.applyToGuildHandler);
                    this.setLink();
                    break;
                }
                case CellDataType.RumorGuild:
                {
                    this.setLink();
                    loc6 = int(this.cellData.data["playerId"]);
                    loc7 = String(this.cellData.data["playerName"]);
                    loc8 = int(this.cellData.data["camp"]);
                    loc9 = int(this.cellData.data["guildId"]);
                    loc10 = new SPublicMiniPlayer();
                    (loc11 = new SEntityId()).id = loc6;
                    loc10.entityId = loc11;
                    loc10.online = 1;
                    loc10.name = loc7;
                    loc10.camp = loc8;
                    (loc12 = new PlayerMiniInfo(loc10)).extendsObj["guildId"] = loc9;
                    this.cellData.data = loc12;
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.showGuildOperate);
                    break;
                }
                case CellDataType.RumorGuild1:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.showGuildMsg);
                    break;
                }
                case CellDataType.RumorCopy:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.gotoCopyHandler);
                    break;
                }
                case CellDataType.RumorMapPoint:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.gotoMapPositionHandler);
                    break;
                }
                case CellDataType.RumorNPC:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.gotNPCHandler);
                    break;
                }
                case CellDataType.RumorPet:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.showRumorPetHandler);
                    break;
                }
                case CellDataType.RumorApplyToTeam:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.applyToTeamHandler);
                    break;
                }
                case CellDataType.CornucopiaBless:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.cornucopiaBlessHandler);
                    break;
                }
                case CellDataType.RumorJewelAdvance:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.jewelAdvanceHandler);
                    break;
                }
                case CellDataType.GOTOGUILDSTRUGGLE:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.goToGuildStruggleHandler);
                    break;
                }
                case CellDataType.GOTOGUILDROBCITYONE:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.goToGuildRobCityOneCopyHandler);
                    break;
                }
                case CellDataType.GOTOGUILDELITE:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.goToGuildElite);
                    break;
                }
                case CellDataType.GUILDGROUP:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.enterGuildGroup);
                    break;
                }
                case CellDataType.EnterGuildAltar:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.enterGuildAltarHandler);
                    break;
                }
                case CellDataType.EnterGuildPasture:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.enterGuildPastureHandler);
                    break;
                }
                case CellDataType.EnterGuildDefense:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.enterGuildDefenseHandler);
                    break;
                }
                case CellDataType.RumorEXPDICE:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.showExpdiceHandler);
                    break;
                }
                case CellDataType.RumorOPENUI:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.openUIHandler);
                    break;
                }
                case CellDataType.MarketWantBuy:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.onClickMarketWantBuy);
                    break;
                }
                case CellDataType.MarketWantSell:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.onClickMarketWantSell);
                    break;
                }
                case CellDataType.WatchVideo:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.onClickWatchVideo);
                    break;
                }
                case CellDataType.Islandpos:
                {
                    this.setLink();
                    this._dipatcher.addEventListener(flash.events.MouseEvent.CLICK, this.onClicIslandpos);
                    break;
                }
                default:
                {
                    this._cellContentElement = new Object /* flash.text.engine.TextElement */(this._cellData.text, this._elementFormat, null);
                    break;
                }
            }
            return;
        }

        /* internal  */setLink(): void
        {
            var loc1=null;
            var loc2=null;
            loc1 = new Object /* flash.text.TextField */();
            loc1.autoSize = flash.text.TextFieldAutoSize.LEFT;
            loc1.multiline = true;
            loc2 = new GTextFormat();
            loc2.color = this._elementFormat.color;
            loc2.underline = true;
            loc2.size = this._elementFormat.fontSize;
            loc2.letterSpacing = this._elementFormat.trackingLeft;
            loc1.defaultTextFormat = loc2;
            loc1.text = this._cellData.text;
            this._cellContentElement = new Object /* flash.text.engine.GraphicElement */(loc1, loc1.width, loc1.height, this._elementFormat, this._dipatcher);
            this.setMouseCanClick();
            return;
        }

        /* internal  */setMouseCanClick(): void
        {
            this._dipatcher.addEventListener(flash.events.MouseEvent.MOUSE_OVER, this.mouseStyleHandler);
            this._dipatcher.addEventListener(flash.events.MouseEvent.MOUSE_OUT, this.mouseStyleHandler);
            return;
        }

        /* internal  */mouseStyleHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (arg1.type == flash.events.MouseEvent.MOUSE_OVER) 
            {
                flash.ui.Mouse.cursor = flash.ui.MouseCursor.BUTTON;
            }
            if (arg1.type == flash.events.MouseEvent.MOUSE_OUT) 
            {
                flash.ui.Mouse.cursor = flash.ui.MouseCursor.AUTO;
            }
            return;
        }

        /* internal  */onMCAddToStage(arg1: Object /* flash.events.Event */): void
        {
            var loc1=arg1.currentTarget as Object /* flash.display.MovieClip */;
            loc1.play();
            return;
        }

        /* internal  */onMCRemoveFromStage(arg1: Object /* flash.events.Event */): void
        {
            var loc1=arg1.currentTarget as Object /* flash.display.MovieClip */;
            loc1.stop();
            return;
        }

        /* internal  */linkToUrlHandler(arg1: Object /* flash.events.Event */): void
        {
            BrowerUtil.getUrl(this._cellData.linkUrl);
            return;
        }

        /* internal  */applyToGuildHandler(arg1: Object /* flash.events.Event */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildApplyPlayersGuild, int(this._cellData.data)));
            return;
        }

        /* internal  */gotoCopyHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=Cache.instance.scene.getNearlyNpcByCopyId(int(this._cellData.data));
            AIManager.onAutoPathAIControl(loc1);
            return;
        }

        /* internal  */gotoMapPositionHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=this._cellData.data["mapId"];
            var loc2=this._cellData.data["mapX"];
            var loc3=this._cellData.data["mapY"];
            var loc4;
            (loc4 = new TaskTargetInfo()).targetType = EntityType.Point;
            loc4.mapId = loc1;
            loc4.x = loc2;
            loc4.y = loc3;
            AIManager.onAutoPathAIControl(loc4);
            return;
        }

        /* internal  */openVIPHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.ShowVIPBoonWindow, this._cellData.data));
            return;
        }

        /* internal  */flyToMapPositionHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=this._cellData.data["mapId"];
            var loc2=this._cellData.data["mapX"];
            var loc3=this._cellData.data["mapY"];
            var loc4;
            (loc4 = new TaskTargetInfo()).targetType = EntityType.Point;
            loc4.mapId = loc1;
            loc4.x = loc2;
            loc4.y = loc3;
            AIManager.onAIControl(loc4, AIType.AI_Convey);
            return;
        }

        /* internal  */gotNPCHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=this._cellData.data["mapId"];
            var loc2=this._cellData.data["mapX"];
            var loc3=this._cellData.data["mapY"];
            var loc4=this._cellData.data["npcId"];
            var loc5;
            (loc5 = new TaskTargetInfo()).targetType = EntityType.NPC;
            loc5.mapId = loc1;
            loc5.id = loc4;
            loc5.x = loc2;
            loc5.y = loc3;
            AIManager.onAutoPathAIControl(loc5);
            return;
        }

        /* internal  */showPlayerOperate(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=arg1.target as Object /* flash.display.DisplayObject */;
            if (loc1.parent) 
            {
                ChatCell._currnetCell = this;
                LayerManager.topLayer.addChild(ChatCell._playerOpList);
                ChatCell._playerOpList.dataProvider = PlayerOpMenuConst.getEnabeldAttri(PlayerOpMenuConst.ChatOpMenu, ChatCell._currnetCell.cellData.data as PlayerMiniInfo);
                if (ChatCell._playerOpList.dataProvider.length > 0) 
                {
                    ChatCell._playerOpList.show(arg1.stageX, arg1.stageY - ChatCell._playerOpList.height, LayerManager.topLayer);
                    Global.stage.addEventListener(flash.events.MouseEvent.CLICK, this.stageClickHandler);
                }
                else 
                {
                    ChatCell._playerOpList.hide();
                }
            }
            arg1.stopImmediatePropagation();
            return;
        }

        /* internal  */onClickCharge(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GotoPay));
            return;
        }

        /* internal  */showGuildOperate(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=arg1.target as Object /* flash.display.DisplayObject */;
            if (loc1.parent) 
            {
                ChatCell._currnetCell = this;
                LayerManager.topLayer.addChild(ChatCell._playerOpList);
                ChatCell._playerOpList.dataProvider = PlayerOpMenuConst.getEnabeldAttri(PlayerOpMenuConst.GuildOpMenu, ChatCell._currnetCell.cellData.data as PlayerMiniInfo);
                if (ChatCell._playerOpList.dataProvider.length > 0) 
                {
                    ChatCell._playerOpList.show(arg1.stageX, arg1.stageY - ChatCell._playerOpList.height, LayerManager.topLayer);
                    Global.stage.addEventListener(flash.events.MouseEvent.CLICK, this.stageClickHandler);
                }
                else 
                {
                    ChatCell._playerOpList.hide();
                }
            }
            arg1.stopImmediatePropagation();
            return;
        }

        /* internal  */showGuildMsg(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=int(this._cellData.data);
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildInfoWindowOpen, loc1));
            return;
        }

        /* internal  */gotoTran(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GoToTransportNPC));
            return;
        }

        /* internal  */openTreasure(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=int(this._cellData.data);
            if (loc1 == ELottertType._ELotterySeabed || loc1 == ELottertType._ELotteryHeaven || loc1 == ELottertType._ELotteryKunlun) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.TreasureModuleOpen, this._cellData.data));
            }
            else if (loc1 == ELottertType._ELotteryChristmas || loc1 == ELottertType._ELotterySpringFestival) 
            {
                AIManager.onAutoPathAIControl(Cache.instance.scene.getNpcByEffect(ENpcEffect._ENpcEffectMoneyTree));
            }
            else if (loc1 == ELottertType._ELotteryHitEgg || loc1 == ELottertType._ELotteryHitEggHigh) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.HitEggUseItem, this._cellData.data));
            }
            return;
        }

        /* internal  */openActive(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=this._cellData.data["bagTab"];
            var loc2=this._cellData.data["type"];
            if (loc1 == "FULIBAG") 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.DailyGiftOpen, loc2));
            }
            return;
        }

        /* internal  */enterMyGuildManor(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=int(this._cellData.data);
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildEnterManor, {"guildId": loc1, "useContribution": false}));
            return;
        }

        /* internal  */stageClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            ChatCell._playerOpList.hide();
            Global.stage.removeEventListener(flash.events.MouseEvent.CLICK, this.stageClickHandler);
            return;
        }

        /* internal  */playerOpItemSelect(arg1: ListEvent): void
        {
            PlayerOpMenuConst.Opearte(ChatCell._playerOpList.list.dataProvider.getItemAt(arg1.index)["label"], ChatCell._currnetCell.cellData.data as PlayerMiniInfo);
            return;
        }

        /* internal  */showToolTipHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=this._cellData.data as ItemData;
            if (!ChatCell._toolTip) 
            {
                ChatCell._toolTip = new Tooltip();
                ChatCell._closeBtn = ObjCreate.createGButton("", ChatCell._toolTip.width - 24, 4, 20, 18, null, "SmallCLoseBtn");
                ChatCell._spTooltipContainer.addChild(ChatCell._toolTip);
                ChatCell._spTooltipContainer.addChild(ChatCell._closeBtn);
            }
            if (loc1.category != ECategory._ECategoryMount) 
            {
                if (loc1.category != ECategory._ECategoryPetEquip) 
                {
                    if (loc1.category != ECategory._ECategoryPetLifeStyle) 
                    {
                        if (loc1.category != ECategory._ECategoryMountEquip) 
                        {
                            ChatCell._toolTip.data = loc1.getToolTipData();
                        }
                        else 
                        {
                            ChatCell._toolTip.data = loc1.getToolTipData(ItemData.ToolTipType_MountEquip);
                        }
                    }
                    else 
                    {
                        ChatCell._toolTip.data = loc1.getToolTipData(ItemData.ToolTipType_PetLifeStyle);
                    }
                }
                else 
                {
                    ChatCell._toolTip.data = loc1.getToolTipData(ItemData.ToolTipType_PetEquip);
                }
            }
            else 
            {
                ChatCell._toolTip.data = loc1.getToolTipData(ItemData.ToolTipType_Mounts);
            }
            ChatCell._spTooltipContainer.x = arg1.stageX;
            ChatCell._spTooltipContainer.y = arg1.stageY;
            LayerManager.toolTipLayer.addChild(ChatCell._spTooltipContainer);
            ChatCell._closeBtn.x = ChatCell._toolTip.width - 24;
            ChatCell._closeBtn.addEventListener(flash.events.MouseEvent.CLICK, this.closeTootipHandler);
            this.resetToolTipPosition();
            return;
        }

        /* internal  */showPetHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=this._cellData.data as SPetInfo;
            Dispatcher.dispatchEvent(new DataEvent(EventName.PetShowInfo, loc1));
            return;
        }

        /* internal  */showRumorPetHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.ChatSearchPet, this._cellData.data));
            return;
        }

        /* internal  */applyToTeamHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=this._cellData.data["copyCode"] as int;
            var loc2=this._cellData.data["playerInfo"] as PlayerMiniInfo;
            var loc3;
            if ((loc3 = CopyConfig.instance.getInfoByCode(loc1)) && CopyUtil.isCrossCopy(loc3)) 
            {
                if (GameMapUtil.isCrossGroupMap()) 
                {
                    if (Cache.instance.crossGroup.isInGroup) 
                    {
                        MsgManager.showRollTipsMsg(Language.getString(40620));
                    }
                    else 
                    {
                        Dispatcher.dispatchEvent(new DataEvent(EventName.CrossGroup_DoApply, loc2.entityId));
                    }
                }
                else 
                {
                    MsgManager.showRollTipsMsg(Language.getString(60905));
                }
            }
            else if (Cache.instance.group.isInGroup) 
            {
                MsgManager.showRollTipsMsg(Language.getString(40620));
            }
            else 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.Group_DoApply, loc2.entityId));
            }
            return;
        }

        /* internal  */cornucopiaBlessHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var e: Object /* flash.events.MouseEvent */;
            var objData: Object;
            var playerId: int;
            var playerName: string;
            var onClose: Function;

            var loc1;
            playerName = null;
            onClose = null;
            e = arg1;
            onClose = (arg1: int): void
            {
                if (arg1 == Alert.OK) 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.FriendRequestAddFriend, {"name": playerName}));
                }
                return;
            }
            objData = this._cellData.data;
            playerId = int(objData["playerId"]);
            playerName = String(objData["playerName"]);
            if (playerId == Cache.instance.role.entityInfo.entityId.id) 
            {
                MsgManager.showRollTipsMsg(Language.getString(40621));
                return;
            }
            if (Cache.instance.friend.isFriendByPlayerId(playerId)) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.CornucopiaBlessToFriend, playerId));
            }
            else 
            {
                Alert.show(Language.getString(40622), null, Alert.OK | Alert.CANCEL, null, onClose);
            }
            return;
        }

        /* internal  */jewelAdvanceHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.Equipment_DoCast, EItemUpdateOper._EItemUpdateJewelAddance));
            return;
        }

        /* internal  */goToGuildStruggleHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.CopyEnterGuildCopy));
            return;
        }

        /* internal  */goToGuildRobCityOneCopyHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.RobCity_doEnterCopy, ECopyType._ECopyRobCityOne));
            return;
        }

        /* internal  */goToGuildElite(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildElite_ShowGuildEliteModule, 0));
            return;
        }

        /* internal  */enterGuildGroup(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildEliteGroup_ShowGroupModule, this._cellData.data as int));
            return;
        }

        /* internal  */enterGuildAltarHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildAnimalGotoNpc));
            return;
        }

        /* internal  */enterGuildPastureHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildPastureGotoNpc));
            return;
        }

        /* internal  */enterGuildDefenseHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.CopyEnterGuildDefense));
            return;
        }

        /* internal  */showExpdiceHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.ShowPlayDice));
            return;
        }

        /* internal  */openUIHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=this._cellData.data;
            var loc2=loc1.toString();
            var loc3=loc2;
            switch (loc3) 
            {
                case "luckyBag":
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.LuckyBagBroadCastOpen));
                    break;
                }
                case "petBlood":
                {
                    Dispatcher.dispatchEvent(new DataEvent(PetEventName.PetShowToTab, 8));
                    break;
                }
                case "robIsland":
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.PetIslandBtnClick));
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }

        /* internal  */onClickMarketWantBuy(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=Number(this._cellData.data);
            Dispatcher.dispatchEvent(new DataEvent(EventName.MarketChatWantToBuy, loc1));
            return;
        }

        /* internal  */onClickMarketWantSell(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=Number(this._cellData.data);
            Dispatcher.dispatchEvent(new DataEvent(EventName.MarketChatWantToSell, loc1));
            return;
        }

        /* internal  */onClickWatchVideo(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.VideoWatchVideo, this._cellData.data));
            return;
        }

        /* internal  */onClicIslandpos(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=SIslandPos(this._cellData.data);
            Dispatcher.dispatchEvent(new DataEvent(EventName.PetIslandMapShowByPosition, loc1));
            return;
        }

        /* internal  */closeTootipHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (ChatCell._spTooltipContainer && ChatCell._spTooltipContainer.parent) 
            {
                ChatCell._spTooltipContainer.parent.removeChild(ChatCell._spTooltipContainer);
            }
            return;
        }

        /* internal  */resetToolTipPosition(): void
        {
            if (ChatCell._spTooltipContainer.x > Global.stage.stageWidth - ChatCell._spTooltipContainer.width - 6) 
            {
                ChatCell._spTooltipContainer.x = ChatCell._spTooltipContainer.x - ChatCell._spTooltipContainer.width - 6;
            }
            var loc1=1;
            ChatCell._spTooltipContainer.y = ChatCell._spTooltipContainer.y - ChatCell._spTooltipContainer.height - 6;
            if (ChatCell._spTooltipContainer.y < 0) 
            {
                ChatCell._spTooltipContainer.y = 0;
            }
            return;
        }

        public get cellData(): ChatCellData
        {
            return this._cellData;
        }

        /* internal */ /* var */_cellData: ChatCellData;

        /* internal */ /* var */_cellContentElement: Object /* flash.text.engine.ContentElement */;

        /* internal */ /* var */_elementFormat: Object /* flash.text.engine.ElementFormat */;

        /* internal */ /* var */_dipatcher: Object /* flash.events.EventDispatcher */;

        /* internal */ static /* var */_currnetCell: ChatCell;

        /* internal */ static /* var */_toolTip: Tooltip;

        /* internal */ static /* var */_closeBtn: GButton;

        /* internal */ static /* var */_spTooltipContainer: Object /* flash.display.Sprite */;

        /* internal */ static /* var */_playerOpList: ListMenu;
    }
